package findEnsemble;

import genetic_algorithm.Chromosome;

import java.util.ArrayList;
import java.util.List;

import utils.RandomGenerator;

public class FindEnsembleChromosome implements Chromosome {

	ArrayList<Integer> indexesList;
	
	public FindEnsembleChromosome(int mlpListSize) {

		// choose a random network for each digit
		indexesList = new ArrayList<Integer>(FindEnsembleMain.NUM_CLASSES);		
		for(int i = 0  ; i < FindEnsembleMain.NUM_CLASSES ; ++i) {
			indexesList.add(RandomGenerator.nextInt(mlpListSize));
		}
	}
	
	public FindEnsembleChromosome(ArrayList<Integer> indexesList) {
		super();
		this.indexesList = indexesList;
	}

	@Override
	public Integer getValue(int index) throws IllegalArgumentException {
		return indexesList.get(index);
	}

	@Override
	public void setValue(int index, Object obj) throws IllegalArgumentException {
		indexesList.set(index, (Integer)obj);
	}
	
	@Override
	public List<Object> getAllValues() {
		return new ArrayList<Object>(indexesList);
	}

	public List<Integer> getAllIndices() {
		return new ArrayList<Integer>(indexesList);
	}
}
